<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  
</head>
<body>
  <div id="app">
    循环数组
    <ul>
      <li v-for="item in arr">
        {{ item }}
      </li>
    </ul>
    <hr>
    循环数组并得到下标
    <ul>
      <li v-for="(item, index) in arr">
        {{ item }}
        =>
        {{ index }}
      </li>
    </ul>
    <hr>
    循环对象
    <ul>
      <li v-for="(item,key, index) in json">
        {{ item }}
        => 
        {{ key }}
        =>
        {{ index }}
      </li>
    </ul>
    <ul>
      <li v-for="item in items">
        <h5>商品名称: {{item.name}}</h5>
        <p>商品价格： {{item.price}}</p>
      </li>
    </ul>
  </div>
  <script src="./vue.js"></script>
  <script>
    const vm = new Vue({
      el: '#app',
      data: {
        arr: ['a', 'b', 'c', 'd'],
        json: {
          name: '小红',
          age: 18,
          gender: '女'
        },
        items: [
          {
            name: '商品1',
            price: 18
          },
          {
            name: '商品2',
            price: 19
          },
          {
            name: '商品3',
            price: 20
          }
        ]
      }
    })
  </script>
</body>
</html>